<?php
/**
 * default actions.
 *
 * @package    Nika
 * @subpackage default
 * @author     Alexey Shapran (alexey.shapran@gmail.com)
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
	public function executeIndex(sfWebRequest $request)
	{
		$this->Page = Doctrine::getTable('Page')->findOneByAlias('index');
		
		$response = $this->getResponse();
		$response->addMeta('keywords', $this->Page['keywords']);
		$response->addMeta('description', $this->Page['description']);
		$response->setTitle(sfConfig::get('app_title')." | ".$this->Page['title']); 
		
		$this->getUser()->setAttribute('s_page',$this->Page['alias']);
		//$this->setTemplate('forum');
	}

	public function executePage()
	{
		$this->Page = $this->getRoute()->getObject();
		$this->forward404Unless($this->Page);
		
		$this->allbranches = Branch::retrieveallbranches();
		
		$response = $this->getResponse();
		$response->addMeta('keywords', $this->Page['keywords']);
		$response->addMeta('description', $this->Page['description']);
		$response->setTitle(sfConfig::get('app_title')." | ".$this->Page['title']); 
		
		$this->getUser()->setAttribute('s_page',$this->Page['alias']);		
		$this->setTemplate('index');
	}

	public function executeError404(sfWebRequest $request)
	{
		return sfView::SUCCESS;
	}
}
